package com.ymatou.iapi.godmch.service;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.database.model.afterserviceinfo;
import com.ymttest.utils.EnvSetup;
/**
*批量查询售后信息Call
*FreeMaker Template自动生成代码
*/
public class getAfterServiceInfoByIdListCall extends YmatouBaseCall{
	private static String opurl ="api/afterService/getAfterServiceInfoByIdList";
	
	public getAfterServiceInfoByIdListCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	
	public String getStatusCode1()
	{
	  return getString("status");
	}
	
	 public String getMessage()
	{
	 return getString("msg");
	}
	
	public List<afterserviceinfo> getList() throws JSONException
	{
		List<afterserviceinfo> infos=new ArrayList<>();
		//afterserviceinfo info=new afterserviceinfo();
	  try{
		  infos = (List<afterserviceinfo>) new Gson().fromJson(new JSONObject(getJsonObject().get("result").toString()).getJSONArray("list").toString(), new TypeToken<List<afterserviceinfo>>() {}.getType());
	} catch (Exception e) {
//		e.printStackTrace();
	}
	  return infos;
	}
}